<!-- SafetySection.vue 子组件 -->
<template>
    <section class="safety-section">
        <h2><span class="icon">{{ icon }}</span> {{ title }}</h2>

        <ul v-if="tips" class="tip-list">
            <li v-for="(tip, index) in tips" :key="index">
                <span class="tip-icon">{{ tip.icon }}</span>
                <div v-html="tip.text"></div>
            </li>
        </ul>

        <div v-if="visualGuide" class="visual-guide">
            <h3>{{ visualGuide.title }}</h3>
            <p v-html="visualGuide.content"></p>
        </div>

        <div v-if="flowChart" class="flow-chart">
            <div class="flow-step">
                <strong>{{ flowChart.title }}</strong>
            </div>
            <div v-for="(step, index) in flowChart.steps" :key="index" class="flow-step"
                :class="{ 'last-step': index === flowChart.steps.length - 1 }">
                {{ step }}
            </div>
        </div>
    </section>
</template>

<script setup>
defineProps({
    title: String,
    icon: String,
    tips: Array,
    visualGuide: Object,
    flowChart: Object
});
</script>

<style scoped>
.safety-section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary-color);
}

.safety-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.safety-section h2 .icon {
    margin-right: 10px;
    font-size: 1.5em;
}

.tip-list {
    list-style: none;
}

.tip-list li {
    padding: 12px 0;
    border-bottom: 1px dashed #eee;
    display: flex;
    align-items: flex-start;
}

.tip-list li:last-child {
    border-bottom: none;
}

.tip-icon {
    margin-right: 12px;
    font-size: 1.2em;
    min-width: 25px;
    text-align: center;
    color: var(--secondary-color);
}

.visual-guide {
    background: #f0f7ff;
    padding: 20px;
    border-radius: 8px;
    margin: 25px 0;
    border: 1px dashed var(--primary-color);
}

.visual-guide h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.flow-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.flow-step {
    background: white;
    padding: 15px;
    border-radius: 8px;
    width: 80%;
    margin-bottom: 10px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    border: 1px solid var(--primary-color);
}

.flow-step:not(.last-step):after {
    content: "↓";
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .flow-step {
        width: 95%;
    }
}
</style>